1. Field of the Invention
The present invention generally relates to a system and method for occlusion culling and, more particularly, to a system and method for accelerating occlusion culling in a graphics computer.
2. Description of the Prior Art
A graphics computer is commonly used to display three-dimensional representations of an object on a two-dimensional display screen. In a typical graphics computer, an object to be rendered is divided into a plurality of graphics primitives. The graphics primitives are basic components of a graphics picture and may be defined by geometries of a point, line, vector, or polygon, such as a triangle. The graphics primitives are fed through a graphics pipeline where various types of processing occur and are then rendered on a display.
An example of a typical graphics pipeline 10 is shown in FIG. 1 and comprises a transform unit 12 for converting input primitive data from one coordinate space to another coordinate space. A light/shade unit 13 applies lighting and flat or smooth shading to the transformed graphics primitives and may additionally provide texture mapping capability to the graphics computer. A clip unit 14 clips primitives to a viewing volume and may further clip the primitives relative to one or more arbitrary clipping planes. At the clip unit 14, the primitive data is modified so that only that portion of the primitive which is inside the viewing volume becomes visible. A perspective divide unit 15 divides all coordinates by w to transform the data from homogeneous to three-dimensional coordinates. To provide perspective projection, the coordinates are further divided at the perspective divide unit 15 by the depth component so that objects farther away appear smaller. At a scan conversion unit 16, vertex coordinates and attributes are converted into pixel colors and depths. The data output from the graphics pipeline 10 includes such things as pixel coordinates or address x and y, pixel depth z, and color r, g, b, and a or color index. It should be understood that the graphics pipeline 10 is only exemplary of the operations performed by a typical graphics computer and that the operations of a particular graphics computer may vary from that described.
The output of the graphics pipeline 10 is typically routed to a frame buffer which comprises a color buffer and a depth buffer. A controller associated with the frame buffer compares the incoming pixel data to the pixel data displayed and controls the storage of the incoming pixel data accordingly. More precisely, the depth component z for each incoming pixel is compared to the depth component z for the pixel currently being displayed at the same x and y address. If the incoming pixel data at that address passes the depth test against the currently displayed pixel data, then the controller will enable the color buffer and depth buffer to store the data for that incoming pixel. The comparison of the current depth and the incoming depth is made for each pixel so that the data associated with the occluded pixels is not stored in the color and depth buffers.
The conventional graphics computer suffers from a disadvantage that it is relatively slow. In the frame buffer, each pixel in a primitive must have its z depth value compared to the depth value for the currently displayed pixel. Since each primitive may have thousands of pixels, a relatively large amount of processing time is expended to determine the visible pixels and to store the depth and color data associated with those pixels. It is therefore a desire in the industry to increase the speed of a graphics computer.
The speed of the graphics computer is also severely impeded since not all of the primitives are ultimately rendered. For instance, in an example of an automobile, the automobile may have a hierarchical data structure with different groupings for such things as body panels, the engine, drive train, interior, electrical, wheels, etc. Some of these data structures, such as the engine, may be quite complex and potentially may be comprised of thousands or millions of graphical primitives which are grouped together and rendered together. If the automobile is displayed from the top with the hood closed, a typical graphics computer may expend a large amount of time processing the multitude of primitives for the engine with the end result being that not a single primitive for the engine is displayed. Similarly, other portions of the automobile, such as the wheels or drive train, may also be entirely occluded. The amount of time expended processing all of these occluded primitives greatly decreases the speed and efficiency of the graphics computer. A need therefore exists for a graphics computer which can quickly render a large number of graphics primitives.